package de.tabuma.wsdl2xform.xform.controller;

import de.tabuma.lib.tabumacontroller;
import de.tabuma.wsdl2xform.xform.*;
import de.tabuma.wsdl2xform.xform.entity.*;
import de.tabuma.wsdl2xform.xform.logik.*;
import de.tabuma.wsdl2xform.xform.controller.*;
import de.tabuma.wsdl2xform.xform.view.*;
import de.tabuma.soap.entity.wsdl.*;

import java.io.*;
import java.util.*;
import java.util.logging.*;

import javax.servlet.*;
import javax.servlet.http.*;

/**
 * @author $Author: alefen $
 * @version $Revision: 1.1 $
 * @since $Date: 2009/12/30 01:10:56 $
 */
public class projectPage3 extends tabumacontroller {
    private static final Logger log = Logger.getLogger(projectPage3.class.getName());

    public projectPage3(String servlet, Hashtable parameter) {
        super(servlet, parameter);
    }
    
    public void navigate(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out) {
        try {
            request.setAttribute(constants.XFORM_NAV,""+constants.NAV_SHOW_PROJECT);
            int projectmode = 0;
            if(request.getParameter(constants.SHOW_PROJECT_MODE)!=null) {
                projectmode = Integer.valueOf(request.getParameter(constants.SHOW_PROJECT_MODE));
            }
            request.setAttribute(constants.SHOW_PROJECT_MODE,""+projectmode);
            log.fine(constants.SHOW_PROJECT_MODE+" "+projectmode);
            
            int projectid = 0;
            if(request.getParameter(constants.PROJECT_ID)!=null) {
                projectid = Integer.valueOf(request.getParameter(constants.PROJECT_ID));
            }
            if(request.getAttribute(constants.PROJECT_ID)!=null) {
                projectid = Integer.valueOf(""+request.getAttribute(constants.PROJECT_ID));
            }
            Project project = ProjectFacade.getProject(projectid);
            request.setAttribute(constants.PROJECT, project);
            log.fine(constants.PROJECT+" "+project);

            request.setAttribute(constants.PROJECT_ID, ""+projectid);
            log.fine(constants.PROJECT_ID+" "+projectid);

        }
        catch(Exception e) {
            log.warning(e.getMessage());
        }
    }
}